load("//third_party/rules_protobuf/objc:rules.bzl", "objc_proto_compile")
load("//tools:objc.bzl", "tink_objc_proto_library")
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")

licenses(["notice"])

# -----------------------------------------------
# common
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "common_proto",
    srcs = [
        "common.proto",
    ],
)

objc_proto_compile(
    name = "common_objc_pb",
    protos = ["common.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# tink
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "tink_proto",
    srcs = [
        "tink.proto",
    ],
)

objc_proto_compile(
    name = "tink_objc_pb",
    protos = ["tink.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# config
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "config_proto",
    srcs = [
        "config.proto",
    ],
)

objc_proto_compile(
    name = "config_objc_pb",
    protos = ["config.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# aes-siv
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_siv_proto",
    srcs = [
        "aes_siv.proto",
    ],
)

objc_proto_compile(
    name = "aes_siv_objc_pb",
    protos = ["aes_siv.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# rsa_ssa_pkcs1
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "rsa_ssa_pkcs1_proto",
    srcs = [
        "rsa_ssa_pkcs1.proto",
    ],
    deps = [
        ":common_proto",
    ],
)

objc_proto_compile(
    name = "rsa_ssa_pkcs1_objc_pb",
    protos = ["rsa_ssa_pkcs1.proto"],
    tags = ["manual"],
    deps = [":common_objc_pb"],
)

# -----------------------------------------------
# rsa_ssa_pss
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "rsa_ssa_pss_proto",
    srcs = [
        "rsa_ssa_pss.proto",
    ],
    deps = [
        ":common_proto",
    ],
)

objc_proto_compile(
    name = "rsa_ssa_pss_objc_pb",
    protos = ["rsa_ssa_pss.proto"],
    tags = ["manual"],
    deps = [":common_objc_pb"],
)

# -----------------------------------------------
# ecdsa
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "ecdsa_proto",
    srcs = [
        "ecdsa.proto",
    ],
    deps = [
        ":common_proto",
    ],
)

objc_proto_compile(
    name = "ecdsa_objc_pb",
    protos = ["ecdsa.proto"],
    tags = ["manual"],
    deps = [":common_objc_pb"],
)

# -----------------------------------------------
# ed25519
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "ed25519_proto",
    srcs = [
        "ed25519.proto",
    ],
)

objc_proto_compile(
    name = "ed25519_objc_pb",
    protos = ["ed25519.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# aes_cmac
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_cmac_proto",
    srcs = [
        "aes_cmac.proto",
    ],
)

objc_proto_compile(
    name = "aes_cmac_objc_pb",
    protos = ["aes_cmac.proto"],
    tags = ["manual"],
    deps = [],
)

# -----------------------------------------------
# hmac
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "hmac_proto",
    srcs = [
        "hmac.proto",
    ],
    deps = [":common_proto"],
)

objc_proto_compile(
    name = "hmac_objc_pb",
    protos = ["hmac.proto"],
    tags = ["manual"],
    deps = [":common_objc_pb"],
)

# -----------------------------------------------
# aes_ctr
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_ctr_proto",
    srcs = [
        "aes_ctr.proto",
    ],
)

objc_proto_compile(
    name = "aes_ctr_objc_pb",
    protos = ["aes_ctr.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# -----------------------------------------------
# aes_ctr_hmac_aead
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_ctr_hmac_aead_proto",
    srcs = [
        "aes_ctr_hmac_aead.proto",
    ],
    deps = [
        ":aes_ctr_proto",
        ":hmac_proto",
    ],
)

objc_proto_compile(
    name = "aes_ctr_hmac_aead_objc_pb",
    protos = ["aes_ctr_hmac_aead.proto"],
    tags = ["manual"],
    deps = [
        ":aes_ctr_objc_pb",
        ":hmac_objc_pb",
    ],
)

# -----------------------------------------------
# aes_gcm
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_gcm_proto",
    srcs = [
        "aes_gcm.proto",
    ],
)

objc_proto_compile(
    name = "aes_gcm_objc_pb",
    protos = ["aes_gcm.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# aes_gcm_siv
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_gcm_siv_proto",
    srcs = [
        "aes_gcm_siv.proto",
    ],
)

objc_proto_compile(
    name = "aes_gcm_siv_objc_pb",
    protos = ["aes_gcm_siv.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# aes_ctr_hmac_streaming
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_ctr_hmac_streaming_proto",
    srcs = ["aes_ctr_hmac_streaming.proto"],
    deps = [
        ":common_proto",
        ":hmac_proto",
    ],
)

objc_proto_compile(
    name = "aes_ctr_hmac_streaming_objc_pb",
    protos = ["aes_ctr_hmac_streaming.proto"],
    tags = ["manual"],
    deps = [
        ":common_objc_pb",
        ":hmac_objc_pb",
    ],
)

# -----------------------------------------------
# aes_gcm_hkdf_streaming
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_gcm_hkdf_streaming_proto",
    srcs = ["aes_gcm_hkdf_streaming.proto"],
    deps = [":common_proto"],
)

objc_proto_compile(
    name = "aes_gcm_hkdf_streaming_objc_pb",
    protos = ["aes_gcm_hkdf_streaming.proto"],
    tags = ["manual"],
    deps = [
        ":common_objc_pb",
    ],
)

# -----------------------------------------------
# aes_eax
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_eax_proto",
    srcs = [
        "aes_eax.proto",
    ],
)

objc_proto_compile(
    name = "aes_eax_objc_pb",
    protos = ["aes_eax.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# chacha20_poly1305
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "chacha20_poly1305_proto",
    srcs = [
        "chacha20_poly1305.proto",
    ],
)

objc_proto_compile(
    name = "chacha20_poly1305_objc_pb",
    protos = ["chacha20_poly1305.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# kms_aead
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "kms_aead_proto",
    srcs = [
        "kms_aead.proto",
    ],
)

objc_proto_compile(
    name = "kms_aead_objc_pb",
    protos = ["kms_aead.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# kms_envelope
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "kms_envelope_proto",
    srcs = [
        "kms_envelope.proto",
    ],
    deps = [":tink_proto"],
)

objc_proto_compile(
    name = "kms_envelope_objc_pb",
    protos = ["kms_envelope.proto"],
    tags = ["manual"],
    deps = [
        ":tink_objc_pb",
    ],
)

# -----------------------------------------------
# ecies_aead_hkdf
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "ecies_aead_hkdf_proto",
    srcs = [
        "ecies_aead_hkdf.proto",
    ],
    deps = [
        ":common_proto",
        ":tink_proto",
    ],
)

objc_proto_compile(
    name = "ecies_aead_hkdf_objc_pb",
    protos = ["ecies_aead_hkdf.proto"],
    tags = ["manual"],
    deps = [
        ":common_objc_pb",
        ":tink_objc_pb",
    ],
)

# -----------------------------------------------
# XChacha20 with Poly1305
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "xchacha20_poly1305_proto",
    srcs = [
        "xchacha20_poly1305.proto",
    ],
)

objc_proto_compile(
    name = "xchacha20_poly1305_objc_pb",
    protos = ["xchacha20_poly1305.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# Hkdf prf
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "hkdf_prf_proto",
    srcs = [
        "hkdf_prf.proto",
    ],
    deps = [":common_proto"],
)

objc_proto_compile(
    name = "hkdf_prf_objc_pb",
    protos = ["hkdf_prf.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# aes_cmac_prf
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "aes_cmac_prf_proto",
    srcs = [
        "aes_cmac_prf.proto",
    ],
)

objc_proto_compile(
    name = "aes_cmac_prf_objc_pb",
    protos = ["aes_cmac_prf.proto"],
    tags = ["manual"],
    deps = [],
)

# -----------------------------------------------
# hmac_prf
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "hmac_prf_proto",
    srcs = [
        "hmac_prf.proto",
    ],
    deps = [":common_proto"],
)

objc_proto_compile(
    name = "hmac_prf_objc_pb",
    protos = ["hmac_prf.proto"],
    tags = ["manual"],
    deps = [":common_objc_pb"],
)


# ----------------------------------------------------------------------------
# prf_based_deriver
# ----------------------------------------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "prf_based_deriver_proto",
    srcs = ["prf_based_deriver.proto"],
    deps = [":tink_proto"],
)

objc_proto_compile(
    name = "prf_based_deriver_objc_pb",
    protos = ["prf_based_deriver.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# empty
# -----------------------------------------------
proto_library(
    visibility = ["//visibility:public"],
    name = "empty_proto",
    srcs = [
        "empty.proto",
    ],
)

objc_proto_compile(
    name = "empty_objc_pb",
    protos = ["empty.proto"],
    tags = ["manual"],
)

# -----------------------------------------------
# objc library
# -----------------------------------------------
tink_objc_proto_library(
    name = "all_objc_proto",
    srcs = [
        ":aes_cmac_objc_pb",
        ":aes_cmac_prf_objc_pb",
        ":aes_ctr_hmac_aead_objc_pb",
        ":aes_ctr_hmac_streaming_objc_pb",
        ":aes_ctr_objc_pb",
        ":aes_eax_objc_pb",
        ":aes_gcm_hkdf_streaming_objc_pb",
        ":aes_gcm_objc_pb",
        ":aes_siv_objc_pb",
        ":chacha20_poly1305_objc_pb",
        ":common_objc_pb",
        ":config_objc_pb",
        ":ecdsa_objc_pb",
        ":ecies_aead_hkdf_objc_pb",
        ":ed25519_objc_pb",
        ":empty_objc_pb",
        ":hmac_objc_pb",
        ":hmac_prf_objc_pb",
        ":kms_aead_objc_pb",
        ":kms_envelope_objc_pb",
        ":rsa_ssa_pkcs1_objc_pb",
        ":rsa_ssa_pss_objc_pb",
        ":tink_objc_pb",
        ":xchacha20_poly1305_objc_pb",
    ],
    tags = ["manual"],
)
